<!-- game.html -->
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
    <title>小游戏</title>
</head>
<body>
    <h1>随机数猜测游戏</h1>
    <p>请猜一个1到100之间的数字:</p>
    <input type="number" id="guess">
    <button onclick="checkGuess()">提交</button>
    <p id="feedback"></p>

    <script>
        const randomNumber = Math.floor(Math.random() * 100) + 1;

        function checkGuess() {
            const userGuess = parseInt(document.getElementById('guess').value);
            const feedback = document.getElementById('feedback');

            if (userGuess === randomNumber) {
                feedback.textContent = '恭喜你，猜对了！';
            } else if (userGuess < randomNumber) {
                feedback.textContent = '太小了，试试更大的数字！';
            } else {
                feedback.textContent = '太大了，试试更小的数字！';
            }
        }
    </script>
</body>
</html>